/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entitesDB;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author CDI104
 */
@Entity
@Table(name = "TELEPHONE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Telephone.findAll", query = "SELECT t FROM Telephone t"),
    @NamedQuery(name = "Telephone.findByTelephId", query = "SELECT t FROM Telephone t WHERE t.telephId = :telephId"),
    @NamedQuery(name = "Telephone.findByNum", query = "SELECT t FROM Telephone t WHERE t.num = :num")})
public class Telephone implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "telephId")
    private BigDecimal telephId;
    @Size(max = 255)
    @Column(name = "NUM")
    private String num;
    @JoinColumn(name = "TELSEDITEURS_idEditeur", referencedColumnName = "idEditeur")
    @ManyToOne
    private Editeur tELSEDITEURSidEditeur;

    public Telephone() {
    }

    public Telephone(BigDecimal telephId) {
        this.telephId = telephId;
    }

    public BigDecimal getTelephId() {
        return telephId;
    }

    public void setTelephId(BigDecimal telephId) {
        this.telephId = telephId;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public Editeur getTELSEDITEURSidEditeur() {
        return tELSEDITEURSidEditeur;
    }

    public void setTELSEDITEURSidEditeur(Editeur tELSEDITEURSidEditeur) {
        this.tELSEDITEURSidEditeur = tELSEDITEURSidEditeur;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (telephId != null ? telephId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Telephone)) {
            return false;
        }
        Telephone other = (Telephone) object;
        if ((this.telephId == null && other.telephId != null) || (this.telephId != null && !this.telephId.equals(other.telephId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitesDB.Telephone[ telephId=" + telephId + " ]";
    }
    
}
